import request from "@/utils/request";

// 获取订单列表
export function getOrderList(params) {
	return request.get("/orders/list", params);
}

// 获取订单详情
export function getOrderDetail(id) {
	return request.get(`/orders/findOne/${id}`);
}

// 新增订单
export function addOrder(data) {
	return request.post("/orders/create", data);
}

// 更新订单
export function updateOrder(id, data) {
	return request.patch(`/orders/update/${id}`, data);
}

// 取消订单
export function cancelOrder(id) {
	return request.patch(`/orders/update/${id}`, { status: "已取消" });
}

// 订单发货
export function shipOrder(id) {
	return request.patch(`/orders/update/${id}`, { status: "已发货" });
}

// 删除订单
export function deleteOrder(id) {
	return request.delete(`/orders/delete/${id}`);
}
